home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3506 < prev    next >
Encoding:
Text File  |  1996-08-06  |  899 b   |  30 lines

  1. Path: longwood.cs.ucf.edu!not-for-mail
  2. From: stevens@longwood.cs.ucf.edu (John Stevens)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Visual C++ 4.0 lacking initializers?
  5. Date: 24 Jan 1996 10:03:50 -0500
  6. Organization: University of Central Florida
  7. Message-ID: <4e5hom$h0p@longwood.cs.ucf.edu>
  8. References: <31049C46.A26@oz.is>
  9. NNTP-Posting-Host: longwood.cs.ucf.edu
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Hßlfdan Ingvarsson (halfdan@oz.is) wrote:
  13. : Is it me or is this sort of code not possible with VC++ 4.0? 
  14.  
  15. : // Declarations of class Foo
  16.  
  17. : // VC++ Complains about the line below with the error
  18. : // error C2436: '__ctor' : cannot initialize member functions
  19. : Foo::Foo(void) : Foo::Foo(10) {}
  20.  
  21. What are you trying to do here? You can initialize member variables by using
  22.  
  23. Foo::Foo() : mData( 1 ) {} ;
  24.  
  25. but what you have written would be inifinite recursion if it was allowed.
  26.  
  27. Hope this helps,
  28. John S.
  29.  
  30.